package pers.cfeng.server.utils;

import java.security.SecureRandom;
import java.util.Random;

/**
 * 生成的随机的一串
 */

public class RandomUtil {

    //返回固定长度的随机的byte，用SecureRandom的nextByte即可
    public static byte[] randomBytes(int length) {
        Random random = new SecureRandom();
        byte[] buffer = new byte[length];
        random.nextBytes(buffer);
        return buffer;
    }
}
